package com.xzx.study.provider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * @author xinzhixuan
 * @version V1.0
 * @date 2019/4/19 20:55
 */
public class StudentDbHelper extends SQLiteOpenHelper {
    private static final String TAG = "TAG-" + SQLiteOpenHelper.class.getSimpleName();

    public StudentDbHelper(Context context) {
        super(context, "provider.db", null, 1);
        Log.i(TAG, "StudentDbHelper");
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.i(TAG, "StudentDbHelper onCreate");
        db.execSQL("create table student(_id integer primary key autoincrement, name varchar)");
        db.execSQL("insert into student(name) values('张三')");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.i(TAG, "StudentDbHelper onUpgrade");
    }
}
